package gameManager;

import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;

/**
 * Player character for RecWars
 * @author Stephen
 *
 */
public class PlayerRect extends PlayerCharacter{

    /**
     * Constructor. Sets up instance variables.
     * @param startPosition Spawn position for the character.
     */
    public PlayerRect (Point startPosition) {
        super(startPosition);
        setDimension(new Dimension(50,50));
        setObjectImage("playerCharacter.jpg"); //Change this
        addCollisionObject("EnemyMoving");
        addCollisionObject("EnemyStaticBoss");
        addNewWeapon(new PlayerWeap(1, 50, this));
        setNameOfInteractable("PlayerRect");
        setHealthValue(3);
        WeaponObject myWeapon = new PlayerWeap(1, 20, this);
        this.addNewWeapon(myWeapon);
    }

 
    /**
     * Returns true if the player should be destroyed.
     */
    @Override
    public boolean isDying () {
        return (getHealthValue() <= 0);
    }

    /**
     * Special effects (graphics, music, etc) for when the player is destroyed.
     */
    @Override
    public void destroy () {        
    }

    /**
     * Describes what happens when the player collides with another object.
     */
    @Override
    public void collisionHandler (Interactable collisionCharacter) {
        for (String s : getNamesOfInteractableCanCollideWith()){
            if(s.equals(collisionCharacter.getNameOfInteractable())){
                this.changeHealthValue(-1);
            }
        }
    }
}
